<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <ul id="ul"></ul>

  <script>
    function getData() {
      return new Promise((resolve, reject) => {
        let xhr = new XMLHttpRequest();
        xhr.open('GET', 'https://mock.mengxuegu.com/mock/65a91543c4cd67421b34c898/movie/movieList', true);
        xhr.send();
        xhr.onreadystatechange = function () {
          if (xhr.readyState == 4 && xhr.status == 200) {
            console.log(JSON.parse(xhr.responseText));
            resolve(JSON.parse(xhr.responseText).movieList)
          }
        }
      })

    }

    function showList(data) {
      data.forEach(item => {
        let li = document.createElement('li')
        li.innerText = item.nm
        document.getElementById('ul').appendChild(li)
      });
      // console.log(data);
    }

    getData().then((res) => {
      showList(res)
    })
    
  </script>
</body>

</html>